regression_covariance Subroutine

public pure subroutine regression_covariance(x, c, rank, condition_number)

Computes the unscaled regression covariance using an SVD of X itself. Singular directions below MAX(M, N) * EPSILON * largest singular value are discarded, giving the Moore-Penrose covariance on identifiable directions. Rank-deficient fits require care: a zero pseudocovariance along a discarded direction does not imply that the corresponding parameter is known exactly.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:,:) :: x

M-by-N design matrix, or a Jacobian whose rows include sqrt(weights).

real(kind=real64), intent(out), allocatable, dimension(:,:) :: c

N-by-N covariance before residual-variance scaling. Nonfinite X gives NaNs.

integer(kind=int32), intent(out), optional :: rank

Number of retained singular directions; zero for empty/invalid input.

real(kind=real64), intent(out), optional :: condition_number

Condition number of X; +infinity for rank deficiency, NaN for invalid X.